<table summary="" id="pagehead" cellpadding="0" cellspacing="0" border="0" width="100%">
	<tr>
		<td><h1>系统下单</h1></td>
		<td class="actions">
			<table summary="" cellpadding="0" cellspacing="0" border="0" align="right">
				<tr>
                	<td ><a href="#">选择客户</a></td>
					<td ><a href="#">选择约货人</a></td>
					<td ><a href="#">选择商品</a></td>
                    <td class='active'><a href="#">查看购物车</a></td>
                    <td><a href="#">确认下单</a></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<script>
function OpenWindow(pid)
{
	var lid = $('#leaderid').val();
	CreateWindow('?app=order&mod=product&pid='+pid+'&lid='+lid,'更改数量和单价');
}

function CloseWindow()
{
	Boxy.loadBoxy.unload();
}

function reloadPage()
{
	location.reload();
}

$(function(){
    $('img[class=del]').click(function(){
        var pid = $(this).attr('rel');
		var lid = $('#leaderid').val();
        if(confirm('真的要从购物车移除此商品吗？')) {
            $.getJSON('?app=<?php echo APP; ?>&mod=moveCar',{pid:pid,lid:lid},function(data){
                if (data.state <= 0)
                {
                    alert(data.message);
                    return false;
                }
				alert(data.message);
				window.location.reload();
            });
        }
    });
    $('#submit_cart').click(function(){
        $.post(location.href,{type:'modi',pid:$('#cart_pid').val(),num:$('#cart_pnum').val(),price:$('#price').val()},function(data){
            if (data.state <= 0)
            {
                alert(data.message);
                return false;
            }
            window.location.reload();
        },'json');
    });
});
</script>
<div class="edit_tab tab">
<div class="bg1">
<div class="bg2">
      <span rel="info" class="span_now">购物车</span>
</div>
</div>
</div>
<input type="hidden" name="leaderid" id="leaderid" value="<?=$this->leaderid; ?>" />
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="table1">
       <tr>
            <th class="th0">编号</th>
            <th class="th1">商品名称</th>
            <th class="th1">原售价</th>
            <th class="th0">已售出</th>
            <th class="th0">购买数量</th>
            <th class="th0">实售价</th>
            <th class="th0">实售小计</th>
            <th class="th0">操作</a>
       </tr>
       <?php foreach((array)$this->products as $product): ?> 
       <tr>
            <td><?=$product['product_id']; ?></td>
            <td><?=$product['name']; ?></td>
            <td><?=$product['price']; ?></td>
            <td><?=$product['sold_num']; ?></td>
            <td><?=$this->productarr[$product['product_id']]['sum'] ?></td>
            <td><?=$this->productarr[$product['product_id']]['price']; ?></td>
            <td><?=$product['pra_price']; ?></td>
            <td>
            	<a href="javascript:;" onclick="return OpenWindow('<?php echo $product['product_id']; ?>');"><img src="./res/image/icon_edit.gif" title='更改数量和单价' class='addcart' /></a>
            	<?php echo opt('trash','javascript:;',"title='从购物车中删除' class='del' rel='{$product['product_id']}'"); ?></td>
       </tr>
       <?php endforeach; ?>
</table>
<div class="page_num">
     <div class="fl">
        <span>原价格总计：<strong>¥<?=$this->total_cost_price; ?></strong>&nbsp;&nbsp;&nbsp;实际价格总计：<strong>¥<?=$this->total_pra_price; ?></strong></span>
     </div>
     <div class="fr">
        <p class="cpager">
           
        </p>
     </div>
</div>
<div style=" width:100%; text-align:right; margin-top:10px;">
	<a href="?app=order&mod=systemsubmit&lid=<?=$this->leaderid; ?>&step=4" class="btn-append"></a>
	<a href="<?=$this->headlinks;?>" class="btn-continue"></a>
</div>